<!-- 设备管理-设备列表页面 -->
<template>
  <div class="app-container">
    <px-form v-show="showSearch" ref="queryRef" class="custom-form-ui" :model="queryParams" :inline="true" label-width="90px">
      <px-form-item label="废物名称">
        <px-select v-model="queryParams.dictWasteCode" placeholder="请选择废物名称" clearable style="width: 240px" filterable>
          <px-option v-for="dict in liquidList" :key="dict.id" :label="dict.itemName" :value="dict.itemValue" />
        </px-select>
      </px-form-item>
      <px-form-item label="入库时间" style="width: 516px !important">
        <px-date-picker
          v-model="dateRange"
          type="datetimerange"
          start-placeholder="开始时间"
          end-placeholder="结束时间"
          format="YYYY-MM-DD HH:mm:ss"
          value-format="YYYY-MM-DD HH:mm:ss"
          :default-time="defaultTime"
        />
      </px-form-item>
      <px-button style="margin-top: -17px" type="primary" icon="" @click="handleQuery('search')">搜索</px-button>
      <px-button style="margin-top: -17px" icon="" @click="resetQuery">重置</px-button>
    </px-form>

    <px-row :gutter="10" class="mb8">
      <px-col :span="1.5">
        <px-button type="primary" icon="" @click="handleAdd">新增</px-button>
      </px-col>
      <px-col :span="1.5">
        <px-button type="primary" plain icon="" :disabled="multiple" @click="handleChuku">出库</px-button>
      </px-col>
      <px-col :span="1.5">
        <px-button type="primary" plain icon="" :disabled="multiple" @click="handleExport">批量下载</px-button>
      </px-col>

      <!-- <px-col :span="1.5">
        <px-button v-has="'CommonEquipListDelete'" type="danger" plain icon="" :disabled="multiple" @click="handleDelete">删除</px-button>
      </px-col> -->
    </px-row>

    <px-table
      v-if="!equipopen && !equipopenDetail"
      v-loading="loading"
      :data="typeList"
      height="calc(100vh - 319px)"
      show-overflow-tooltip
      border
      @selection-change="handleSelectionChange"
    >
      <px-table-column type="selection" width="40" />
      <px-table-column label="序号" align="center" prop="id" />
      <px-table-column label="废物名称" prop="wasteName">
        <template #default="scope">
          <span>{{ scope.row.wasteName }}</span>
        </template>
      </px-table-column>

      <px-table-column label="废物类别" prop="wasteType">
        <template #default="scope">
          <span>{{ scope.row.wasteType }}</span>
        </template>
      </px-table-column>

      <px-table-column label="废物代码" width="160" prop="wasteCode">
        <template #default="scope">
          <span>{{ scope.row.wasteCode }}</span>
        </template>
      </px-table-column>

      <px-table-column label="危废特性" prop="hazardCharacteristics">
        <template #default="scope">
          <span>{{ scope.row.hazardCharacteristics }}</span>
        </template>
      </px-table-column>
      <px-table-column label="入库日期" prop="inboundTime">
        <template #default="scope">
          <span>{{ scope.row.inboundTime }}</span>
        </template>
      </px-table-column>
      <!-- <px-table-column label="入库时间" prop="inboundTime">
        <template #default="scope">
          <span>{{ scope.row.inboundTime }}</span>
        </template>
      </px-table-column> -->
      <px-table-column label="废物数量" prop="inboundQuantity">
        <template #default="scope">
          <span>{{ scope.row.inboundQuantity }}{{ scope.row.wasteUnit }}</span>
        </template>
      </px-table-column>
      <px-table-column label="盛废容器及容积" width="120" prop="container">
        <template #default="scope">
          <span>{{ scope.row.container }}</span>
        </template>
      </px-table-column>
      <px-table-column label="容器存放位置" width="110" prop="storageLocation">
        <template #default="scope">
          <span>{{ scope.row.storageLocation }}</span>
        </template>
      </px-table-column>
      <px-table-column label="运送部门" prop="transportDepartment">
        <template #default="scope">
          <span>{{ scope.row.transportDepartment }}</span>
        </template>
      </px-table-column>
      <px-table-column label="接收人" prop="receiverName">
        <template #default="scope">
          <span>{{ scope.row.receiverName }}</span>
        </template>
      </px-table-column>
      <px-table-column label="状态" align="center" prop="status">
        <template #default="scope">
          <div v-if="scope.row.status == 'VALID'" class="level1">有效</div>
          <div v-else class="level2">无效</div>
        </template>
      </px-table-column>
      <px-table-column fixed="right" label="操作" align="center" width="140">
        <template #default="scope">
          <px-button link type="primary" @click="handleDetail(scope.row.id)">
            <px-tooltip class="box-item" content="详情" placement="top">
              <px-icon><Tickets /></px-icon> </px-tooltip
          ></px-button>
          <px-button v-if="scope.row.status != 'INVALID'" link type="primary" @click="handleEditor(scope.row.id)">
            <px-tooltip class="box-item" content="编辑" placement="top">
              <px-icon><EditPen /></px-icon> </px-tooltip
          ></px-button>
          <px-button v-if="scope.row.status != 'INVALID'" link type="danger" @click="handleDelete(scope.row)"
            ><px-tooltip class="box-item" content="删除" placement="top">
              <px-icon><Delete /></px-icon> </px-tooltip
          ></px-button>
        </template>
      </px-table-column>
      <template #empty>
        <px-empty :image-size="150" />
      </template>
    </px-table>

    <pagination
      v-if="!equipopen && !equipopenDetail"
      v-show="total > 0"
      v-model:page="queryParams.pageNum"
      v-model:limit="queryParams.pageSize"
      style="margin-bottom: -10px"
      :total="total"
      @pagination="getList"
    />

    <!-- 添加或修改参数配置对话框 -->

    <px-scrollbar v-if="equipopen" class="editorEquip">
      <px-button style="margin-left: 24px" type="primary" :icon="ArrowLeft" @click="cancel">返回</px-button>
      <px-descriptions style="padding: 20px" class="margin-top" title="基本信息" :column="3" border>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">单据号:</div>
          </template>
          {{ equipdata.inboundNumber }}
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">废物名称:</div>
          </template>
          {{ equipdata.wasteName }}
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">废物类别:</div>
          </template>
          {{ equipdata.wasteType }}
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">废物代码:</div>
          </template>
          {{ equipdata.wasteCode }}
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">入库时间:</div>
          </template>
          {{ equipdata.inboundTime }}
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">废物数量:</div>
          </template>
          {{ equipdata.inboundQuantity }}{{ equipdata.wasteUnit }}
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">盛废容器及容积:</div>
          </template>
          {{ equipdata.container }}
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">容器存放位置:</div>
          </template>
          {{ equipdata.storageLocation }}
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">运送部门:</div>
          </template>
          {{ equipdata.transportDepartment }}
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">接收人:</div>
          </template>
          {{ equipdata.receiverName }}
        </px-descriptions-item>
      </px-descriptions>
    </px-scrollbar>
    <px-scrollbar v-if="equipopenDetail" class="addEquip">
      <px-button style="margin-left: 24px" type="primary" :icon="ArrowLeft" @click="equipopenDetailcancel">返回</px-button>
      <px-form
        ref="detailruleFormRef"
        :disabled="fromdisable"
        :rules="rules"
        :model="equipdata"
        :inline="true"
        class="demo-form-inline"
        label-width="160px"
      >
        <div
          class="box-card1"
          :style="{
            height: jibenxinxiFlg == true ? '' : '42px'
          }"
        >
          <div class="card-header" @click="setqingdanFlg()">
            <div class="card-title">基本信息</div>
            <div class="card-main">
              <px-icon v-if="!jibenxinxiFlg"><ArrowDown /></px-icon>
              <px-icon v-else><ArrowUp /></px-icon>
            </div>
          </div>
          <div class="form-div">
            <px-row>
              <px-col :span="8">
                <px-form-item label="单据号">
                  <px-input v-model="equipdata.inboundNumber" disabled="true" placeholder="单据号为系统生成" clearable /> </px-form-item
              ></px-col>
              <px-col :span="8">
                <px-form-item label="废物名称" prop="dictWasteCode">
                  <px-select
                    v-model="equipdata.dictWasteCode"
                    clearable
                    filterable
                    style="width: calc(100% - 100px)"
                    placeholder="请选择废物名称"
                    @change="setreceiveCompanyCode"
                  >
                    <px-option v-for="dict in liquidList" :key="dict.id" :label="dict.itemName" :value="dict.itemValue" />
                  </px-select>
                </px-form-item>
              </px-col>
              <px-col :span="8">
                <px-form-item label="废物类别" prop="wasteType">
                  <px-input v-model="equipdata.wasteType" disabled="true" placeholder="废物类别与废物名称关联" clearable /> </px-form-item
              ></px-col>
            </px-row>
            <px-row>
              <px-col :span="8">
                <px-form-item label="废物代码" prop="wasteCode">
                  <px-input v-model="equipdata.wasteCode" disabled="true" placeholder="废物代码与废物名称关联" clearable /> </px-form-item
              ></px-col>
              <px-col :span="8">
                <px-form-item label="危废特性" prop="hazardCharacteristics">
                  <px-input v-model="equipdata.hazardCharacteristics" placeholder="危废特性与废物名称关联" clearable /> </px-form-item
              ></px-col>
              <px-col :span="8">
                <px-form-item label="入库时间" prop="inboundTime">
                  <px-date-picker
                    v-model="equipdata.inboundTime"
                    style="width: calc(100% - 100px)"
                    placeholder="请选择入库时间"
                    type="datetime"
                    format="YYYY-MM-DD HH:mm:ss"
                    value-format="YYYY-MM-DD HH:mm:ss"
                    @change="checkTime"
                  />
                </px-form-item>
              </px-col>
            </px-row>
            <px-row>
              <px-col :span="8">
                <px-form-item label="废物数量" prop="inboundQuantity">
                  <px-input v-model="equipdata.inboundQuantity" style="width: calc(100% - 200px)" placeholder="请输入废物数量" clearable />
                  <px-select v-model="equipdata.wasteUnit" filterable placeholder="Select" style="width: 90px">
                    <px-option v-for="item in wasteUnitoptions" :key="item.value" :label="item.label" :value="item.value" /> </px-select
                ></px-form-item>
              </px-col>
              <px-col :span="8">
                <px-form-item label="盛废容器及容积" prop="container">
                  <px-input v-model="equipdata.container" placeholder="请输入盛废容器及容积" clearable /> </px-form-item
              ></px-col>
              <px-col :span="8">
                <px-form-item label="容器存放位置" prop="storageLocation">
                  <px-input v-model="equipdata.storageLocation" placeholder="请输入容器存放位置" clearable /> </px-form-item
              ></px-col>
            </px-row>
            <px-row>
              <px-col :span="8">
                <px-form-item label="运送部门" prop="transportDepartment">
                  <px-input v-model="equipdata.transportDepartment" placeholder="请输入运送部门" clearable /> </px-form-item
              ></px-col>
              <px-col :span="8">
                <px-form-item label="接收人" prop="receiverName">
                  <px-input v-model="equipdata.receiverName" placeholder="请输入接收人" clearable /> </px-form-item
              ></px-col>
            </px-row>
          </div>
        </div>
      </px-form>
    </px-scrollbar>
    <div v-if="equipopenDetail" class="px-dialog-footer">
      <px-button @click="equipopenDetailcancel">取消</px-button>
      <px-button v-if="fromdisable" type="primary" @click="equipopenDetailcancel">关闭</px-button>
      <px-button v-else type="primary" :disabled="photoStatusFlag || fileStatusFlag" @click="equipopenDetailsubmitForm(detailruleFormRef)"
        >保存</px-button
      >
    </div>
    <px-dialog v-model="progressVisible" title="上传进度" width="30%" center align-center>
      <px-progress :percentage="Math.floor(progressPercent)" />
    </px-dialog>
  </div>
</template>

<script setup name="Dict" lang="ts">
defineOptions({
  name: "SystemDataDict"
});
// import { router } from "@/router";
import { ArrowLeft } from "@px-ui/icons-vue";
import { useRouter, useRoute } from "vue-router";
import { PxMessage, PxMessageBox } from "px-ui";
import { getCurrentInstance, ref, toRefs, reactive, onMounted } from "vue";
import { getToken } from "@/utils/auth";
import {
  queryChildByTypeCodeAndItemValue,
  queryListPagepush,
  queryDetailpush,
  addpush,
  updatepush,
  deletepush,
  queryBatchOutInfopull
} from "@/api/machineClass";
const jibenxinxiFlg = ref(true);
const defaultTime: [Date, Date] = [new Date(2000, 1, 1, 0, 0, 1), new Date(2000, 1, 1, 23, 59, 59)];
const setqingdanFlg = () => {
  jibenxinxiFlg.value = !jibenxinxiFlg.value;
};
const router = useRouter();
const jiqicanshuFlg = ref(true);
const wasteUnit = ref("吨");
const setjiqicanshuFlg = () => {
  jiqicanshuFlg.value = !jiqicanshuFlg.value;
};
const shebeitaizhangFlg = ref(true);
const setshebeitaizhangFlg = () => {
  shebeitaizhangFlg.value = !shebeitaizhangFlg.value;
};
const moxingshezhiFlg = ref(true);
const setmoxingshezhiFlg = () => {
  moxingshezhiFlg.value = !moxingshezhiFlg.value;
};
const setreceiveCompanyCode = val => {
  let setvalue = null;
  setvalue = liquidList.value.find(option => option.itemValue == val);
  console.log(setvalue);
  if (setvalue && setvalue?.itemDesc != "") {
    equipdata.value.wasteType = JSON.parse(setvalue.itemDesc).type;
    equipdata.value.wasteCode = JSON.parse(setvalue.itemDesc).code;
    equipdata.value.hazardCharacteristics = JSON.parse(setvalue.itemDesc).tx;
  } else {
    equipdata.value.wasteType = "";
    equipdata.value.wasteCode = "";
    equipdata.value.hazardCharacteristics = "";
  }

  //console.log(setvalue);
};

const setAddreceiveCompanyCode = val => {
  let setvalue = null;
  setvalue = liquidList.value.find(option => option.itemValue == val);
  if (setvalue && setvalue.itemDesc != "") {
    equipdata.value.receiveCompanyCode = JSON.parse(setvalue.itemDesc).receiveCompanyCode;
  } else {
    // equipdata.value.receiveCompanyCode = "";
  }
  //console.log(setvalue);
};
const route = useRoute();
onMounted(() => {
  if (route.params.chukuList) {
    // handleDetail(route.query.equipmentId);
    console.log(chukuList);
  }
});
const { proxy }: any = getCurrentInstance();

const typeList = ref([]);
const detailruleFormRef = ref();
const progressVisible = ref(false);
const open = ref(false);
const equipopen = ref(false);
const equipopenDetail = ref(false);
const fromdisable = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const progressPercent = ref(0);
const dateRange = ref([]);

// 图片是否上传完，是否可以保存
const savePhotoStatus = val => {
  photoStatusFlag.value = val;
};
// 文件是否上传完，是否可以保存
const saveFileStatus = val => {
  fileStatusFlag.value = val;
};

const waterstatusList = [
  {
    value: "VALID",
    name: "全部"
  },
  {
    value: "INVALID",
    name: "已删除"
  }
];
const buttonTitle = ref("");
const data = reactive({
  liquidList: [],
  transportCompanyList: [],
  receiveCompanyList: [],
  typeIdList: [],
  categoryList: [],
  equipmentTypeList: [],
  positionList: [],
  equipmentDeptList: [],
  modelIdList: [],
  chukuList: [],
  form: {},
  wasteUnitoptions: [
    {
      value: "克",
      label: "克"
    },
    {
      value: "千克",
      label: "千克"
    },
    {
      value: "吨",
      label: "吨"
    }
  ],
  photoStatusFlag: false,
  fileStatusFlag: false,
  equipdata: {
    id: "",
    inboundNumber: "",
    wasteName: "",
    wasteCode: "",
    wasteType: "",
    hazardCharacteristics: "",
    inboundTime: "",
    inboundQuantity: "",
    wasteUnit: "吨",
    container: "",
    storageLocation: "",
    transportDepartment: "",
    receiverName: "",
    dictWasteCode: ""
  },
  queryParams: {
    orderByColumn: "",
    isAsc: "",
    dictWasteCode: "",
    startTime: "",
    endTime: "",
    status: "",
    orderBy: "",
    pageNum: 1,
    pageSize: 20
  },
  rules: {
    dictWasteCode: [{ required: true, message: "废物名称不能为空", trigger: "change" }],
    wasteType: [{ required: true, message: "废物类别不能为空", trigger: "blur" }],
    wasteCode: [{ required: true, message: "废物代码不能为空", trigger: "blur" }],
    hazardCharacteristics: [{ required: true, message: "危废特性不能为空", trigger: "blur" }],
    inboundTime: [{ required: true, message: "入库时间不能为空", trigger: "blur" }],
    inboundQuantity: [{ required: true, message: "废物数量不能为空", trigger: "blur" }],
    container: [{ required: true, message: "盛废容器及容积不能为空", trigger: "blur" }],
    storageLocation: [{ required: true, message: "容器存放位置不能为空", trigger: "blur" }],
    transportDepartment: [{ required: true, message: "运送部门不能为空", trigger: "blur" }],
    receiverName: [{ required: true, message: "接收人不能为空", trigger: "blur" }]
  },
  headers: {
    Authorization: "Bearer " + getToken().accessToken || ""
  },
  moduleName: "",
  dialogImageUrl: "",
  imageVisible: false
});

const {
  liquidList,
  chukuList,
  queryParams,
  form,
  rules,
  equipdata,
  equipmentTypeList,
  modelIdList,
  photoStatusFlag,
  fileStatusFlag,
  wasteUnitoptions
} = toRefs(data);
const checkTime = () => {
  if (equipdata.value.manufactureDate && equipdata.value.warrantyEndDate) {
    if (equipdata.value.manufactureDate > equipdata.value.warrantyEndDate) {
      PxMessage({
        message: "开始时间不能大于结束时间",
        type: "error"
      });
    }
  }
};
const getqueryCategoryList = () => {
  queryChildByTypeCodeAndItemValue({
    value: "DS01M",
    typeCode: "WCTS"
  }).then((response: any) => {
    //console.log(response);
    liquidList.value = response;
    queryChildByTypeCodeAndItemValue({
      value: "DW01M",
      typeCode: "WCTS"
    }).then((response: any) => {
      //console.log(response);
      liquidList.value = [...liquidList.value, ...response];
    });
  });
};
getqueryCategoryList();
function getList() {
  loading.value = true;
  if (dateRange.value != null) {
    queryParams.value.startTime = dateRange.value[0];
    queryParams.value.endTime = dateRange.value[1];
  } else {
    queryParams.value.startTime = "";
    queryParams.value.endTime = "";
  }

  queryListPagepush(queryParams.value).then((response: any) => {
    typeList.value = response.data;
    total.value = response.total;
    loading.value = false;
  });
}

/** 取消按钮 */
function cancel() {
  equipopen.value = false;
}
function equipopenDetailcancel() {
  equipopenDetail.value = false;
}
/** 表单重置 */
function reset() {
  form.value = {
    id: undefined,
    dictionaryName: undefined,
    dictionaryType: undefined,
    status: "VALID",
    remarks: undefined
  };
  proxy.resetForm("dictRef");
}
/** 搜索按钮操作 */
function handleQuery(type) {
  if (type == "search") {
    queryParams.value.pageNum = 1;
  }
  getList();
}
/** 重置按钮操作 */
function resetQuery() {
  queryParams.value = {
    pageNum: queryParams.value.pageNum,
    pageSize: queryParams.value.pageSize,
    orderByColumn: "",
    isAsc: "",
    dictWasteCode: "",
    startTime: "",
    endTime: "",
    status: "",
    orderBy: ""
  };
  dateRange.value = [];
  handleQuery("reset");
}

/** 新增按钮操作 */
function handleAdd() {
  buttonTitle.value = "新增";
  jibenxinxiFlg.value = true;
  jiqicanshuFlg.value = true;
  shebeitaizhangFlg.value = true;
  moxingshezhiFlg.value = true;
  equipopenDetail.value = true;
  fromdisable.value = false;
  equipmentTypeList.value = [];
  modelIdList.value = [];
  equipdata.value = {
    id: "",
    inboundNumber: "",
    wasteName: "",
    wasteCode: "",
    wasteType: "",
    hazardCharacteristics: "",
    inboundTime: "",
    inboundQuantity: "",
    wasteUnit: "吨",
    container: "",
    storageLocation: "",
    transportDepartment: "",
    receiverName: ""
  };
}
const handleDetail = async val => {
  jibenxinxiFlg.value = true;
  jiqicanshuFlg.value = true;
  shebeitaizhangFlg.value = true;
  moxingshezhiFlg.value = true;
  const data = await queryDetailpush({ id: val });
  //console.log(data);

  equipopen.value = true;
  // equipopenDetail.value = true;
  fromdisable.value = true;
  equipdata.value = data;
  //console.log(equipdata);
};

const handleEditor = async val => {
  buttonTitle.value = "编辑";
  jibenxinxiFlg.value = true;
  jiqicanshuFlg.value = true;
  shebeitaizhangFlg.value = true;
  moxingshezhiFlg.value = true;

  const data = await queryDetailpush({ id: val });
  //console.log(data);
  equipopenDetail.value = true;
  fromdisable.value = false;
  equipdata.value = data;
};
/** 多选框选中数据 */
function handleSelectionChange(selection) {
  chukuList.value = selection;
  ids.value = selection.map(item => item.id);
  single.value = selection.length != 1;
  multiple.value = !selection.length;
}

/** 提交按钮 */

const equipopenDetailsubmitForm = async (formEl: any) => {
  if (!formEl) return;
  await formEl.validate(async valid => {
    if (valid) {
      const params = {
        id: equipdata.value.id,
        inboundNumber: equipdata.value.inboundNumber,
        wasteName: equipdata.value.wasteName,
        wasteCode: equipdata.value.wasteCode,
        wasteType: equipdata.value.wasteType,
        hazardCharacteristics: equipdata.value.hazardCharacteristics,
        inboundTime: equipdata.value.inboundTime,
        inboundQuantity: equipdata.value.inboundQuantity,
        wasteUnit: equipdata.value.wasteUnit,
        container: equipdata.value.container,
        storageLocation: equipdata.value.storageLocation,
        transportDepartment: equipdata.value.transportDepartment,
        receiverName: equipdata.value.receiverName,
        dictWasteCode: equipdata.value.dictWasteCode,
        updateTime: equipdata.value.updateTime
      };
      if (buttonTitle.value == "新增") {
        addpush(params).then((response: any) => {
          PxMessage({
            message: `${buttonTitle.value == "新增" ? "添加成功" : "修改成功"}`,
            type: "success"
          });
          resetQuery();
          equipopenDetail.value = false;
        });
      } else {
        updatepush(params).then((response: any) => {
          PxMessage({
            message: `${buttonTitle.value == "新增" ? "添加成功" : "修改成功"}`,
            type: "success"
          });
          resetQuery();
          equipopenDetail.value = false;
        });
      }
    }
  });
};
/** 删除按钮操作 */
function handleDelete(row) {
  //console.log(row);
  // const dictIds = [];
  // if (row.equipmentId != undefined) {
  //   dictIds.push(row.equipmentId);
  // } else {
  //   dictIds.push(...ids.value);
  // }
  PxMessageBox.confirm('是否确认删除"' + row.wasteName + '"？', "温馨提示", {
    confirmButtonText: "确定",
    cancelButtonText: "取消",
    type: "warning",
    draggable: true
  })
    .then(async () => {
      const data = await deletepush({ id: row.id });
      PxMessage({
        message: "删除成功",
        type: "success"
      });
      getList();
    })
    .catch(() => {});
}
//出库
const handleChuku = () => {
  queryBatchOutInfopull({
    dictWasteCode: chukuList.value[0].dictWasteCode,
    inIds: ids.value
  }).then((response: any) => {
    console.log(response);
    // liquidList.value = [...liquidList.value, ...response];
    router.push({ path: "/water/halfwaste/hazardouswastepull" });
    localStorage.setItem("chukuList", JSON.stringify(response));
  });
  console.log(ids.value);
};

/** 导出按钮操作 */
function handleExport() {
  const dictIds = [];
  dictIds.push(...ids.value);
  //console.log(dictIds);
  // liquidExport({ ids: dictIds }).then((response: any) => {
  //   PxMessage({
  //     message: "导出成功",
  //     type: "success"
  //   });
  // });
  // downloadParams.value.ids = selectIds.value;
  const params = { ids: dictIds };
  proxy.download("post", "/operation/api/v1/water/hazardWasteIn/export", params, "危险废弃物入库.xlsx");
}

getList();
</script>
<style scoped lang="scss">
.addEquip {
  position: absolute;
  top: 0;
  top: 5px;
  left: 0;
  width: calc(100% - 48px);
  height: calc(100% - 40px);
  margin: 24px;
  background: white;
}

.editorEquip {
  position: absolute;
  top: 0;
  top: 5px;
  left: 0;
  width: calc(100% - 48px);
  height: calc(100% - 40px);
  margin: 24px;
  background: white;
}

.px-dialog-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 2002;
  width: 100%;
  height: 50px;
  padding-top: 10px;
  padding-right: 34px;
  text-align: right;
  background: white;
  box-shadow: 0 0 10px 0 rgb(0 0 0 / 16%);
}

.card-header {
  min-height: 40px;
  padding: 14px 15px 7px !important;
  cursor: pointer;
  user-select: none;
  background: #e7eefb;
}

.card-title {
  float: left;
  line-height: 14px;
}

.card-main {
  float: left;
  margin: -3px 8px 0 5px;
  cursor: pointer;
}

.box-card1 {
  width: calc(100% - 48px);
  margin: 24px;
  overflow: hidden;
  border: 1px solid #dfdfdf;
  border-radius: 4px;
}

.box-card2 {
  width: calc(100% - 48px);
  margin: 24px;
  overflow: hidden;
  border: 1px solid #dfdfdf;
  border-radius: 4px;
}

.box-card3 {
  width: calc(100% - 48px);
  margin: 24px;
  overflow: hidden;
  border: 1px solid #dfdfdf;
  border-radius: 4px;
}

.box-card4 {
  width: calc(100% - 48px);
  height: 261px;
  margin: 24px;
  overflow: hidden;
  border: 1px solid #dfdfdf;
  border-radius: 4px;
}

.demo-form-inline {
  .px-input {
    --px-input-width: calc(100% - 100px);
  }

  .px-form-item {
    width: 100%;
  }

  .px-textarea__inner {
    width: calc(100% - 100px) !important;
  }

  .px-form-item__label {
    font-weight: 400 !important;
  }
}

.form-div {
  padding: 24px;

  .px-row {
    margin-bottom: 16px;
  }
}

.px-icon {
  font-size: 16px !important;
}

:deep(.px-tabs__header) {
  // padding-left: 6px !important;
}

:deep(.px-tabs--top .px-tabs__item.is-top.is-active) {
  border: none;

  .pane-bottom {
    line-height: 30px;
    border-bottom: 2px solid #3b82f6;
  }
}

:deep(.px-tabs .px-tabs__item) {
  .pane-bottom {
    line-height: 30px;
  }
}

.pane-line {
  position: absolute;
  top: 12px;
  right: 0;
  height: 15px;
  color: #dcdcdc;
  border-left: 1px solid #dcdcdc;
}

:deep(.custom-form-ui .px-form-item) {
  width: 250px !important;
}

:deep(.px-upload) {
  --px-upload-dragger-padding-horizontal: 18px;
}

:deep(.px-upload--picture-card) {
  --px-upload-picture-card-size: 93px;

  position: absolute;
}

.file-upload-dom {
  :deep(.px-upload-list--picture-card .px-upload-list__item) {
    position: relative;
    width: 96px;
    height: 96px;
    overflow: visible;

    .filebg {
      position: absolute;
      display: none;
      width: 96px;
      height: 96px;
      background: #0006;
    }

    .filedelect {
      margin: 35px;
      font-size: 22px !important;
      color: white;
      cursor: pointer;
    }

    &:hover {
      .filebg {
        display: block;
      }
    }

    .filesvg {
      position: absolute;
      top: 30px;
      left: 30px;
      font-size: 70px;
    }
  }

  :deep(.px-upload--picture-card) {
    --px-upload-picture-card-size: 93px;

    border: none;
  }
}

:deep(.px-upload-list--picture-card .px-upload-list__item) {
  width: 96px;
  height: 96px;
}

.filename {
  position: absolute;
  bottom: -30px;
  width: 96px;
  overflow: hidden;
  color: rgb(166 167 172);
  text-overflow: ellipsis;
  white-space: nowrap;
}

:deep(.px-descriptions__label.px-descriptions__cell.is-bordered-label) {
  width: 166px;
  background: #e7eefb;
  border: 1px solid #dfdfdf;
}

:deep(.px-descriptions__body .px-descriptions__table.is-bordered .px-descriptions__cell) {
  border: 1px solid #dfdfdf;
}

.cell-item {
  text-align: right;
}

:deep(.px-table__header) {
  thead {
    tr {
      background-color: #e7eefb !important;

      th {
        font-size: 13px;
        font-weight: bold;
        color: #000;
        background-color: #e7eefb !important;
      }
      // th:nth-child(2) {
      //   font-size: 13px;
      //   font-weight: bold;
      //   color: #000;
      //   border-right: none;
      //   background-image: linear-gradient(to right, red, blue);
      // }
      // th:nth-child(3) {
      //   font-size: 13px;
      //   font-weight: bold;
      //   color: #000;
      //   border-right: none;
      //   background-image: linear-gradient(to right, #0400fc, yellow);
      // }
    }
  }
}

:deep(.px-table--isfixedHeader .px-table__header-wrapper .px-table-fixed-column--right) {
  background-color: #e7eefb !important;
}

:deep(.px-upload-list--picture-card > li:first-of-type) {
  margin-left: 104px;
}

:deep(.px-upload-list--picture-card) {
  min-height: 100px;
}

.level1 {
  width: 52px;
  height: 24px;
  margin: 0 auto;
  text-align: center;
  background: #ecfdf5;
  border: 1px solid #10b981;
  border-radius: 4px;
}

.level2 {
  width: 52px;
  height: 24px;
  margin: 0 auto;
  text-align: center;
  background: #fcf6ec;
  border: 1px solid #fda620;
  border-radius: 4px;
}

.level3 {
  width: 52px;
  height: 24px;
  margin: 0 auto;
  text-align: center;
  background: #eff6ff;
  border: 1px solid #3b82f6;
  border-radius: 4px;
}
</style>
